<%@ taglib uri="/WEB-INF/translator.tld" prefix="trans" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> 
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> 
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%String ctx = request.getContextPath();%>
<trans:initPage module="editgroup" />
<LINK rel="stylesheet" type="text/css" href="<html:rewrite page='/alf.css'/>">

<logic:present name="verbose">
<font color="red" class="text_searchbold"><bean:write name="verbose"/>

</logic:present>
	
	<body>
<script>
function setSg(target) {document.forms[0].sgdel.value=target;};
</script>
		<html:form action="/editgroup">
		   <table align="center" border="0" cellpadding="5" cellspacing="1" background=<%=ctx%>/images/pixelbgtable.gif>
		    <tr><td colspan=2 class=textalb>
    	     <html:hidden property="id"/>
<logic:notEqual name="editGroupForm" property="id" value="0">
			<trans:showPageMessage label="editgroup.editinggroup" />: <bean:write name="editGroupForm" property="name"/>
</logic:notEqual>
<logic:equal name="editGroupForm" property="id" value="0">
			<trans:showPageMessage label="editgroup.addagroup" />
</logic:equal>
			</td>
			</tr>
			<tr bgcolor="#FFFFFF">
		    <td colspan=2 class="text_search">
			<trans:showPageMessage label="editgroup.name" />: <html:text property="name" styleClass="text" onkeydown="textCounter(this.form.name,this.form.cname,200);" onkeyup="textCounter(this.form.name,this.form.cname,200);"/> <input readonly type="text" name="cname" size="3" maxlength="4" value=""> <trans:showPageMessage label="charactersleft" /><html:errors property="name"/>
			</td>
			</tr>
			<tr bgcolor="#FFFFFF">
		    <td colspan=2 class="text_search">
		    <table class="text">
		    <tr>
		    <td>
			<trans:showPageMessage label="editgroup.description" />:
			</td>
			<td>
	 		<html:textarea property="description" cols="50" rows="2" styleClass="text" onkeydown="textCounter(this.form.description,this.form.cdescription,3000);" onkeyup="textCounter(this.form.description,this.form.cdescription,3000);"/>  <input readonly type="text" name="cdescription" size="3" maxlength="4" value="">				
	 		</td>
	 		</tr>
	 		</table>
			</td>
			</tr>
			<tr bgcolor="#FFFFFF">
		    <td colspan=1 class="text_search">	
			<trans:showPageMessage label="editgroup.role" />: <html:select property="role">
			<html:options collection="roles" property="id" labelProperty="name"/>
			</html:select>
			<html:errors property="role"/>
			</td>
		    <td class="text_search">	
				    <html:submit styleClass="buton" property="add_update">
	    		    <logic:notEqual name="editGroupForm" property="id" value="0">
				    <trans:showPageMessage label="editgroup.updatenamedescriptionandrole" hide_link="true" /></logic:notEqual>		   
					<logic:equal name="editGroupForm" property="id" value="0">
					<trans:showPageMessage label="editgroup.addnewgroup" hide_link="true"/></logic:equal>
					</html:submit>
							    
			</td>
			</tr>
	
	
		   
<logic:notEqual name="editGroupForm" property="id" value="0">

<logic:notPresent name="noSgroups">

<logic:present name="supergroups" scope="request">
	<tr><td colspan=2 class=textalb>
	<trans:showPageMessage label="editgroup.supergroupsassignedtothisgroup" />:
	</td>
	</tr>
	
<logic:iterate scope="request" name="supergroups" id="group">
			<tr bgcolor="#FFFFFF">
		    <td colspan=2 class="text_search">	
						    		    <bean:write name="group" property="name"/>
			</td>
			</tr>
</logic:iterate>
</p>
</logic:present>
<tr bgcolor="#FFFFFF">
<td class="text_search">	
			<trans:showPageMessage label="editgroup.supergroups" />:
</td>
<td class="text_search">	
			<html:select property="sgAdd">
		 	<html:options collection="groups" property="id" labelProperty="name"/>
			</html:select>
			<html:errors property="sgAdd"/><html:submit property="add_sg" styleClass="buton"><trans:showPageMessage label="editgroup.linkassupergroup" hide_link="true"/></html:submit>
			<html:submit property="del_sg" styleClass="buton"><trans:showPageMessage label="editgroup.unlinksupergroup" hide_link="true"/></html:submit>
</td>
</tr>
</logic:notPresent>

<tr><td colspan=2 class=textalb>
<trans:showPageMessage label="editgroup.usermembership" />
</td></tr>
<logic:present name="assigned_users" scope="request">
<logic:iterate scope="request" name="assigned_users" id="user_name">
<tr bgcolor="#FFFFFF">
<td colspan=2 class="text_search">	
<html:img page="/images/arrow_blue.gif"/>
<bean:write name="user_name" property="fullName"/>
</td>
</tr>		
</logic:iterate>
</logic:present>
<tr bgcolor="#FFFFFF">
<td class="text_search">	

<trans:showPageMessage label="editgroup.users" />:
</td>
<td class="text_search">	
 <html:select property="userAdd">
			<html:options collection="users" property="id" labelProperty="fullName"/>
			</html:select><br>
			<html:submit property="add_user" styleClass="buton"><trans:showPageMessage label="editgroup.addtogroup" hide_link="true"/></html:submit>
			<html:submit property="del_user" styleClass="buton"><trans:showPageMessage label="editgroup.removefromgroup" hide_link="true"/></html:submit>
</td>
</tr>
</logic:notEqual>
<logic:notEqual name="editGroupForm" property="id" value="0">
</logic:notEqual>
</table>
<script type="text/javascript" src="<html:rewrite page='/javascript/textCounter.js'/>"></script>
</html:form>



